package com.solution.admin.product.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.solution.admin.product.dao.ProductInvisiableDao;
import com.solution.admin.product.entity.ProductInvisiableEntity;
import com.solution.common.dao.impl.BaseDaoImpl;
import com.solution.common.page.PageBean;
import com.solution.common.page.PageParam;

/**
 * 商品可见性DAO实现
 * @author solin
 * @date 2017-09-20 15:31:21
 */
@Repository
public class ProductInvisiableDaoImpl extends BaseDaoImpl<ProductInvisiableEntity> implements ProductInvisiableDao {
	
	@Autowired
	private SqlSessionTemplate sessionTemplate;

	/**
	 * 保存商品可见性信息
	 * @param ebProductInvisiableEntity
	 * @return
	 * @author solin
	 * @date 2017-09-20 15:31:21
	 */
	@Override
	public long saveEbProductInvisiable(ProductInvisiableEntity ebProductInvisiableEntity) {
		return super.insert(ebProductInvisiableEntity);
	}

	/**
	 * 分页查询商品可见性信息
	 * @param pageParam 分页对象
	 * @param ebProductInvisiable 分页参数
	 * @return PageBean 分页参数及数据
	 * @author solin
	 * @date 2017-09-20 15:31:21
	 */
	public PageBean listEbProductInvisiablePage(PageParam pageParam, Map<String, Object> param) {
		return super.listPage(pageParam, param);
	}

	/**
	 * 更新商品可见性
	 * @param ebProductInvisiableEntity
	 * @return
	 * @author solin
	 * @date 2017-09-20 15:31:21
	 */
	@Override
	public int updateEbProductInvisiable(ProductInvisiableEntity ebProductInvisiableEntity) {
		return super.update(ebProductInvisiableEntity);
	}

	/**
	 * 删除商品可见性
	 * @param ebProductInvisiableId
	 * @return
	 * @author solin
	 * @date 2017-09-20 15:31:21
	 */
	public int deleteEbProductInvisiableById( Long id) {
		return super.deleteById(id);
	}
	
	/**
	 * 根据商品ID删除商品可见性
	 * @param id
	 * @return
	 * @author solin
	 * @date 2017-09-20 15:31:21
	 */
	public int deleteEbProductInvisiableByProductId(Long productId) {
		return sessionTemplate.delete("deleteProductInvisiableByProductId", productId);
	}
	
	/**
	 * 根据条件查询商品可见性
	 * @param param
	 * @return
	 * @author solin
	 * @date 2017-09-20 15:31:21
	 */
	@Override
	public List<ProductInvisiableEntity> listEbProductInvisiable( Map<String, Object> param) {
		return super.listBy(param);
	}
}
